﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administrators/Admin.Master" AutoEventWireup="true" CodeBehind="CapNhatTinTuc.aspx.cs" Inherits="CongThongTin.Administrators.CapNhatTinTuc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="ContentPlaceHolder_rightContent">
     <script language="javascript" type="text/javascript">

         function getRandomNumber() {
             var randomnumber = Math.random(10000);
             return randomnumber;
         }

         function OnClientAsyncFileUploadComplete(sender, args) {
             var handlerPage = '<%= Page.ResolveClientUrl("~/ImageHandler.ashx")%>';
             var queryString = '?option=0&randomno=' + getRandomNumber();
             var src = handlerPage + queryString;
             var clientId = '<%=previewImage.ClientID %>';
             document.getElementById(clientId).setAttribute("src", src);
         }

        
    </script>
    <ajaxToolkit:ToolkitScriptManager runat="Server" EnablePartialRendering="true" ID="ToolkitScriptManager1" />
    <h3>
        Tin tức</h3>
    <div class="custom_quoteOfDay_TinTuc">
      <asp:UpdatePanel ID="upInputControl" runat="server">
        <ContentTemplate>
                <table style="width: 100%;">
            <tr>
                <td class="style2">
                    Tên thể loại tin tức:</td>
                <td>
                    &nbsp;
                    <asp:DropDownList ID="ddlTenTheLoai" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="ddlTenTheLoai_SelectedIndexChanged" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Tên loại tin tức:</td>
                <td>
                    &nbsp;
                    <asp:DropDownList ID="ddlTenLoai" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Tiêu đề:&nbsp; </td>
                <td>
                    <asp:TextBox ID="tbTieuDe" runat="server" CssClass="sedang" 
                        Width="100%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    Nội dung tóm tắt:</td>
                <td>
                    <asp:TextBox ID="tbNoiDungTomTat" runat="server" CssClass="sedang" 
                        Width="100%" Rows="5" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
                    <tr>
                        <td class="style2">
                            Hình ảnh mô tả:
                        </td>
                        <td>
                           <ajaxToolkit:AsyncFileUpload ID="axAsyncFileUpload" runat="server"
                                OnClientUploadComplete="OnClientAsyncFileUploadComplete"
                                OnUploadedComplete="OnAsyncFileUploadComplete" />
                        </td>
                    </tr>
                    <tr>
                        <td class="style2">
                            &nbsp;</td>
                        <td>
                            <asp:Image ID="previewImage" runat="server" Width="150px" Height="150px"/>
                         </td>
                    </tr>
            <tr>
                <td class="style2" valign="top">
                    Nội dung:</td>
                <td >
                  <asp:UpdatePanel ID="updatePanel2" runat="server">                    
                    <ContentTemplate>  
                             <asp:TextBox runat="server" ID="tbNoiDung" TextMode="MultiLine" Columns="50" Rows="20"
                                    Width="100%" /><br />
                            <ajaxToolkit:HtmlEditorExtender ID="htmlEditorExtender2" TargetControlID="tbNoiDung"
                                runat="server" DisplaySourceTab="True" OnImageUploadComplete="ajaxFileUpload_OnUploadComplete" >
                                <Toolbar> 
                <ajaxToolkit:Undo />
                <ajaxToolkit:Redo />
                <ajaxToolkit:Bold />
                <ajaxToolkit:Italic />
                <ajaxToolkit:Underline />
                <ajaxToolkit:StrikeThrough />
                <ajaxToolkit:Subscript />
                <ajaxToolkit:Superscript />
                <ajaxToolkit:JustifyLeft />
                <ajaxToolkit:JustifyCenter />
                <ajaxToolkit:JustifyRight />
                <ajaxToolkit:JustifyFull />
                <ajaxToolkit:InsertOrderedList />
                <ajaxToolkit:InsertUnorderedList />
                <ajaxToolkit:CreateLink />
                <ajaxToolkit:UnLink />
                <ajaxToolkit:RemoveFormat />
                <ajaxToolkit:SelectAll />
                <ajaxToolkit:UnSelect />
                <ajaxToolkit:Delete />
                <ajaxToolkit:Cut />
                <ajaxToolkit:Copy />
                <ajaxToolkit:Paste />
                <ajaxToolkit:BackgroundColorSelector />
                <ajaxToolkit:ForeColorSelector /> 
                <ajaxToolkit:FontNameSelector />
                <ajaxToolkit:FontSizeSelector />
                <ajaxToolkit:Indent />
                <ajaxToolkit:Outdent />
                <ajaxToolkit:InsertHorizontalRule />
                <ajaxToolkit:HorizontalSeparator /> 
                <ajaxToolkit:InsertImage />
            </Toolbar>
                            </ajaxToolkit:HtmlEditorExtender>
                       </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
                    <tr>
                        <td class="style2">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
            <tr>
                <td class="style2">
                    &nbsp;
                    <asp:Button ID="btnThemMoi" runat="server" Text="Thêm mới" CssClass="button" 
                        onclick="btnThemMoi_Click"/>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
        </ContentTemplate>
       </asp:UpdatePanel>
    </div>
    <div class="clear" style="padding-left:2%;">
    </div>
</asp:Content>

